namespace IniTechCaash.Domain.Migrations
{
    using System;
    using System.Data.Entity.Migrations;
    
    public partial class Update1 : DbMigration
    {
        public override void Up()
        {
            DropForeignKey("dbo.SourceDocuments", "JournalEntry_Id", "dbo.JournalEntries");
            DropIndex("dbo.SourceDocuments", new[] { "JournalEntry_Id" });
            AddColumn("dbo.JournalEntries", "Name", c => c.String(maxLength: 128));
            AddColumn("dbo.JournalEntryLines", "Date", c => c.DateTime(nullable: false));
            AddColumn("dbo.JournalEntryLines", "CreatedBy", c => c.String(nullable: false, maxLength: 256));
            AddColumn("dbo.JournalEntryLines", "CreatedDate", c => c.DateTime(nullable: false));
            AddColumn("dbo.JournalEntryLines", "LastModifiedBy", c => c.String(nullable: false, maxLength: 256));
            AddColumn("dbo.JournalEntryLines", "LastModifiedDate", c => c.DateTime(nullable: false));
            AddColumn("dbo.SourceDocuments", "Name", c => c.String(maxLength: 128));
            AlterColumn("dbo.JournalEntryLines", "Description", c => c.String(maxLength: 256));
            CreateIndex("dbo.SourceDocuments", "Id");
            AddForeignKey("dbo.SourceDocuments", "Id", "dbo.JournalEntryLines", "Id");
            DropColumn("dbo.SourceDocuments", "JournalEntry_Id");
        }
        
        public override void Down()
        {
            AddColumn("dbo.SourceDocuments", "JournalEntry_Id", c => c.Int(nullable: false));
            DropForeignKey("dbo.SourceDocuments", "Id", "dbo.JournalEntryLines");
            DropIndex("dbo.SourceDocuments", new[] { "Id" });
            AlterColumn("dbo.JournalEntryLines", "Description", c => c.String(maxLength: 128));
            DropColumn("dbo.SourceDocuments", "Name");
            DropColumn("dbo.JournalEntryLines", "LastModifiedDate");
            DropColumn("dbo.JournalEntryLines", "LastModifiedBy");
            DropColumn("dbo.JournalEntryLines", "CreatedDate");
            DropColumn("dbo.JournalEntryLines", "CreatedBy");
            DropColumn("dbo.JournalEntryLines", "Date");
            DropColumn("dbo.JournalEntries", "Name");
            CreateIndex("dbo.SourceDocuments", "JournalEntry_Id");
            AddForeignKey("dbo.SourceDocuments", "JournalEntry_Id", "dbo.JournalEntries", "Id", cascadeDelete: true);
        }
    }
}
